package xyz.molzhao.util;

import cn.hutool.core.text.StrPool;
import cn.hutool.core.thread.ThreadUtil;

public class CommonUtil {
    private CommonUtil() {
    }

    // 耗时
    public static void timeCost(long millis) {
        ThreadUtil.sleep(millis);
    }

    // 创建耗时行为
    public static void createBehavior(String behavior, long millis) {
        System.out.println(String.join(StrPool.DASHED, String.valueOf(System.currentTimeMillis()), String.valueOf(Thread.currentThread().getId()),
                String.valueOf(Thread.currentThread().getName()), behavior));
        timeCost(millis);
    }

    // 创建行为
    public static void createBehavior(String behavior) {
        System.out.println(String.join(StrPool.DASHED, String.valueOf(System.currentTimeMillis()), String.valueOf(Thread.currentThread().getId()),
                String.valueOf(Thread.currentThread().getName()), behavior));
    }
}
